package com.novax.ex.activity.infrastructure.mapper;

import com.novax.ex.activity.infrastructure.entity.TaskEtRewards;
import com.novax.ex.common.base.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
* @author Hsylient
* @description 针对表【task_et_rewards(用户获取et的情况)】的数据库操作Mapper
* @createDate 2023-06-29 14:35:28
* @Entity com.novax.ex.activity.infrastructure.entity.TaskEtRewards
*/
public interface TaskEtRewardsMapper extends BaseMapper {
    /**
     * 根据用户ID查询用户获得Et情况
     *
     * @param uid 用户ID
     * @return 用户获取Et奖励的情况
     */
    List<TaskEtRewards> selectEtAwardByUid(@Param("uid") Long uid);


    int countByUserId(@Param("userId") Long userId, @Param("currency") String currency);

    int updateTotalFreezeAndUserId(@Param("totalFreeze") BigDecimal totalFreeze, @Param("userId") Long userId, @Param("currency") String currency);

    /**
     * @Description: 更新活动解冻余额
     * @Author: ChenXi
     * @Date:  2023/6/28 10:16
     * @param userId
     * @param amount
     * @return: int
     **/
    int updateUnfreeze(@Param("userId") Long userId, @Param("amount") BigDecimal amount, @Param("currency") String currency);

    /**
     * @Description: 根据用户id查询
     * @Author: ChenXi
     * @Date:  2023/6/28 15:39
     * @param userId
     * @return: com.novax.ex.activity.infrastructure.entity.TaskEtRewards
     **/
    TaskEtRewards findByUserId(@Param("userId") Long userId, @Param("currency") String currency);

    /**
     * Description: 根据用户id查询所有
     *
     * @param userId uid
     * @return java.util.List<com.novax.ex.activity.infrastructure.entity.TaskEtRewards>
     * @Author shaw
     * @Date 2023/10/9 13:55
     */
    List<TaskEtRewards> findAllByUserId(@Param("userId") Long userId);


    TaskEtRewards total(@Param("condition") Map<String, Object> condition);

}
